//
//  LoadImageProgressView.swift
//  WatermarkCamera
//
//  Created by 赵新 on 6/7/2024.
//

import UIKit
import AxcBedrock

class LoadImageProgressView: BaseView {
    lazy var progressLayer: CircularProgressLayer = {
        let layer = CircularProgressLayer()
        return layer
    }()

    var progress: CGFloat = 0 {
        didSet { progressLayer.setProgress(progress) }
    }

    override func layoutSubviews() {
        super.layoutSubviews()
        let progressSize: CGFloat = 50
        let x = (frame.size.width - progressSize) / 2
        let y = (frame.size.height - progressSize) / 2
        progressLayer.frame = .init(x: x, y: y, width: progressSize, height: progressSize)
    }

    override func createUI() {
        backgroundColor = .clear
        isUserInteractionEnabled = false
        layer.addSublayer(progressLayer)
        progressLayer.strokeColor = "5290FD".axc.cgColor
    }
}
